
//#include "..\SystemInitialData\SystemInformation.h"


/***********************************************
 * not put the data in memory
 * this is for SOC function to use
 ***********************************************/
//#define SOC_BATTERY_OV_VOLTAGE     __2ND_BATTERY_OV_PROTECTION_     //5600
//#define SOC_BATTERY_UV_VOLTAGE     __2ND_BATTERY_UV_PROTECTION_     //3700
//#define SOC_1st_CELL_OV_VOLTAGE     4250 //mV
//#define SOC_1st_CELL_UV_VOLTAGE     2500 //mV


#define OCV_TABLE_POINTS 51
#define NUM_OF_OCV_LINE  1

#define RESIDUAL_CAPACITY_INDEX         0
#define RESIDUAL_OCV_CURRENT_INDEX      1


/*
; TERMINAL_VOLTAGE units is mV
; RESIDUAL_CAPACITY units is percentage
; Please sort from largest to smallest
// 2600mAh cell, 25 degree, OCV Table
*/

const unsigned int RealOCVTable[OCV_TABLE_POINTS][NUM_OF_OCV_LINE+1] =
{
////////////// RESIDUAL CAPACITY ////////////////////////////////////////////////////////////////
//10.4Ah     OCV      
//Capacity,   OCV,        ///////////////////////
//   (%)      (mV)    
    { 100,   41850   },   //index = 00       
    { 98 ,   41616   },   //index = 01       
    { 96 ,   41381   },   //index = 02       
    { 94 ,   41172   },   //index = 03       
    { 92 ,   40969   },   //index = 04       
    { 90 ,   40766   },   //index = 05       
    { 88 ,   40577   },   //index = 06       
    { 86 ,   40389   },   //index = 07       
    { 84 ,   40209   },   //index = 08       
    { 82 ,   40046   },   //index = 09       
    { 80 ,   39874   },   //index = 10       
    { 78 ,   39720   },   //index = 11       
    { 76 ,   39572   },   //index = 12       
    { 74 ,   39426   },   //index = 13       
    { 72 ,   39294   },   //index = 14       
    { 70 ,   39161   },   //index = 15       
    { 68 ,   39043   },   //index = 16       
    { 66 ,   38931   },   //index = 17       
    { 64 ,   38815   },   //index = 18       
    { 62 ,   38722   },   //index = 19       
    { 60 ,   38622   },   //index = 20       
    { 58 ,   38475   },   //index = 21       
    { 56 ,   38286   },   //index = 22       
    { 54 ,   38122   },   //index = 23       
    { 52 ,   37980   },   //index = 24       
    { 50 ,   37895   },   //index = 25       
    { 48 ,   37838   },   //index = 26       
    { 46 ,   37778   },   //index = 27       
    { 44 ,   37755   },   //index = 28       
    { 42 ,   37731   },   //index = 29       
    { 40 ,   37712   },   //index = 30       
    { 38 ,   37696   },   //index = 31       
    { 36 ,   37681   },   //index = 32       
    { 34 ,   37662   },   //index = 33       
    { 32 ,   37645   },   //index = 34       
    { 30 ,   37616   },   //index = 35       
    { 28 ,   37557   },   //index = 36       
    { 26 ,   37526   },   //index = 37       
    { 24 ,   37398   },   //index = 38       
    { 22 ,   37271   },   //index = 39       
    { 20 ,   37118   },   //index = 40       
    { 18 ,   36837   },   //index = 41       
    { 16 ,   36564   },   //index = 42       
    { 14 ,   36264   },   //index = 43       
    { 12 ,   35971   },   //index = 44       
    { 10 ,   35714   },   //index = 45       
    { 8  ,   35511   },   //index = 46       
    { 6  ,   35295   },   //index = 47       
    { 4  ,   34857   },   //index = 48       
    { 2  ,   33775   },   //index = 49       
    { 0  ,   31490   }    //index = 50
};                                                            



#define CHG_OCV_TABLE_POINTS            41
#define CHG_NUM_OF_OCV_LINE             3
#define RESIDUAL_CHG_CAPACITY_INDEX         0
#define RESIDUAL_CHG_1st_TEMPERATURE_INDEX  1
#define RESIDUAL_CHG_2nd_TEMPERATURE_INDEX  2
#define RESIDUAL_CHG_3rd_TEMPERATURE_INDEX  3

const unsigned int CHG_RealOCVTable[CHG_OCV_TABLE_POINTS][CHG_NUM_OF_OCV_LINE +1] =
{
////////////// RESIDUAL CAPACITY ///////////////////////?//////////////////////////////////////////////
//      10.4Ah      1st       2nd          3rd          ///////////////////////////////////////////////
//  Capacity,    CHG 2A,     CHG 2A,      CHG 2A,       ///////////////////////////////////////////////
//     * 100    Lower Temp,  Middle Temp, Higher Temp   ///////////////////////////////////////////////
//      (%)        (mV)          (mV)         (mV)      ///////////////////////////////////////////////
    {	 10000   ,  41929,  41938,	41946   },   //index = 00 
    {	 9750    ,  41851,  41839,	41826   },   //index = 01 
    {	 9500    ,  41771,  41736,	41701   },   //index = 02 
    {	 9250    ,  41690,  41632,	41574   },   //index = 03 
    {	 9000    ,  41612,  41522,	41431   },   //index = 04 
    {	 8750    ,  41533,  41362,	41192   },   //index = 05 
    {	 8500    ,  41384,  41166,	40949   },   //index = 06 
    {	 8250    ,  41205,  40963,	40722   },   //index = 07 
    {	 8000    ,  41033,  40780,	40526   },   //index = 08 
    {	 7750    ,  40890,  40612,	40333   },   //index = 09 
    {	 7500    ,  40752,  40460,	40169   },   //index = 10 
    {	 7250    ,  40635,  40322,	40009   },   //index = 11 
    {	 7000    ,  40521,  40197,	39873   },   //index = 12 
    {	 6750    ,  40423,  40083,	39743   },   //index = 13 
    {	 6500    ,  40327,  39976,	39626   },   //index = 14 
    {	 6250    ,  40243,  39884,	39526   },   //index = 15 
    {	 6000    ,  40157,  39793,	39429   },   //index = 16 
    {	 5750    ,  40079,  39711,	39342   },   //index = 17 
    {	 5500    ,  39996,  39620,	39244   },   //index = 18 
    {	 5250    ,  39919,  39528,	39138   },   //index = 19 
    {	 5000    ,  39843,  39440,	39038   },   //index = 20 
    {	 4750    ,  39779,  39369,	38960   },   //index = 21 
    {	 4500    ,  39717,  39307,	38898   },   //index = 22 
    {	 4250    ,  39665,  39252,	38840   },   //index = 23 
    {	 4000    ,  39616,  39203,	38790   },   //index = 24 
    {	 3750    ,  39577,  39160,	38742   },   //index = 25 
    {	 3500    ,  39543,  39122,	38701   },   //index = 26 
    {	 3250    ,  39520,  39091,	38662   },   //index = 27 
    {	 3000    ,  39502,  39065,	38627   },   //index = 28 
    {	 2750    ,  39486,  39041,	38595   },   //index = 29 
    {	 2500    ,  39449,  39003,	38557   },   //index = 30 
    {	 2250    ,  39330,  38915,	38500   },   //index = 31 
    {	 2000    ,  38960,  38649,	38339   },   //index = 32 
    {	 1750    ,  38353,  38144,	37935   },   //index = 33 
    {	 1500    ,  37690,  37487,	37283   },   //index = 34 
    {	 1250    ,  37212,  36959,	36706   },   //index = 35 
    {	 1000    ,  36880,  36606,	36332   },   //index = 36 
    {	 750     ,  36636,  36339,	36041   },   //index = 37 
    {	 500     ,  36507,  36159,	35810   },   //index = 38 
    {	 250     ,  35836,  35434,	35031   },   //index = 39 
    {	 0       ,  29000,  29000,	29000   }    //index = 40 
};


//#define TERMINAL_VOLTAGE_INDEX 0                            
//#define RESIDUAL_CAPACITY_INDEX 1                           
//                                                            
//const int RealOCVTable[OCV_TABLE_POINTS][2] =               
//{                                                           
//  {  4087,  9994  },    //index=00,  1st                    
//  {  3997,  9496  },    //index=01,  2nd                    
//  {  3941,  8998  },    //index=02,  3rd                    
//  {  3890,  8499  },    //index=03,  4th                    
//  {  3843,  8000  },    //index=04,  5th                    
//  {  3800,  7501  },    //index=05,  6th                    
//  {  3761,  7002  },    //index=06,  7th                    
//  {  3727,  6504  },    //index=07,  8th                    
//  {  3695,  6005  },    //index=08,  9th                    
//  {  3666,  5507  },    //index=09,  10th                   
//  {  3641,  5009  },    //index=10,  11th                   
//  {  3618,  4510  },    //index=11,  12th                   
//  {  3596,  4012  },    //index=12,  13th                   
//  {  3572,  3513  },    //index=13,  14th                   
//  {  3544,  3015  },    //index=14,  15th                   
//  {  3511,  2515  },    //index=15,  16th                   
//  {  3473,  2016  },    //index=16,  17th                   
//  {  3432,  1518  },    //index=17,  18th                   
//  {  3381,  1019  },    //index=18,  19th                   
//  {  3299,  521   },    //index=19,  20th                   
//  {  2748,  0     }     //index=20,  21th                   
//};                                                          
                                                              
                                                              
